﻿@using si.caha.Repository;
@{
    Layout = "/tpl/_layout.cshtml";
    PageData["PageTitle"] = "Categories list";
    var dataContext = new DataContext();

    var categoryRepository = new CategoryRepository(dataContext);
    var grid = new WebGrid(categoryRepository.GetAll(), ajaxUpdateContainerId: "grid");
}
<div id="grid">
    @grid.GetHtml(
        tableStyle: "grid",
        headerStyle: "gridhead",
        alternatingRowStyle: "altRow",
        columns: grid.Columns(
            grid.Column("CategoryId"),
            grid.Column("CategoryParentId"),
            grid.Column("Level"),
            grid.Column("Title"),
            grid.Column("", format:@<a href="@Href("~/Admin/Categories/Delete/" + @item.CategoryId)">Delete</a>),
            grid.Column("", format:@<a href="@Href("~/Admin/Categories/Edit/" + @item.CategoryId)">Edit</a>)
        )
    )
</div>
<a href="@Href("~/Admin/Categories/Create")">Create category</a>